# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pysafebrowsing
pkgname=('python2-pysafebrowsing' 'python-pysafebrowsing')
_pkgname=pysafebrowsing
pkgver=0.1.4
pkgrel=1
pkgdesc='Google Safe Browsing API python wrapper.'
arch=('any')
url='https://pypi.org/project/pysafebrowsing/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('e3afc926d39ca2e767ed52e2190c88061a3f7e739fd9f7071f4525a471e1e7f1982659ffb4587ab7ba3f9c22f78716da9eb832050ccd0aaec034f9640ce8b3ce')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pysafebrowsing() {
  depends=('python2' 'python2-configparser' 'python2-requests')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/safebrowsing" "$pkgdir/usr/bin/safebrowsing2"
}

package_python-pysafebrowsing() {
  depends=('python' 'python-requests')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

